package com.hpeng.sys.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.hpeng.sys.dao.NoticeDao;
import com.hpeng.sys.model.Notice;
import com.hpeng.sys.model.Staff;
import com.hpeng.util.GenericDaoImpl;
import com.hpeng.util.Pagination;

@Component("noticeDao")  
public class NoticeDaoImpl extends GenericDaoImpl<Notice,String> implements NoticeDao{
	public List<Notice> getTheAll(){
		return getAll();
	}
	public Pagination<Notice> getPagination(int pageNumber,
			String[] hql,String[] values, String order) {
		Pagination<Notice> pagination = null;
		StringBuffer sb = new StringBuffer();
		try {
			for(String str:hql){
				sb.append(str);
			}
			pagination = getPagination(sb.toString()+order, values, pageNumber);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pagination;
	}
	public void deleteNotice(List<String> notids){
		for(int i = 0;i < notids.size();i++){
			remove(notids.get(i));
		}
	}
	public void addNotice(Notice notice){
		save(notice);
	}
	public Notice findById(String id){
		return get(id);
		
	}
	public void updateNotice(Notice notice){
		System.out.println("卧槽");
		save(notice);
	}
}
